<?php
require_once dirname(__FILE__) . '/includes/common.inc.php';
require_once dirname(__FILE__) . '/includes/pdoorm.inc.php';

header('Content-Type: text/plain');
$action = MiscUtils::getParam('action', NULL);

try {
  switch ($action) {
    case 'checkpwd':
      checkpwd();
      break;
      
    case 'updatepwd':
      updatepwd($action);
      break;  

    case 'logout':
      logout();
      break;
      
    case 'save':
        {
            savesign($action);
        }
      break;

    case 'customerquery':
        {
            cquery($action);
        }
      break;      

    case 'password':
        {
            updatepwd($action);
        }
      break;      
            
      
    default:
      break;
  }
} catch (PDOException $e) {
  echo $e->getMessage();
}


function checkpwd()
{
	$oid = MiscUtils::getParam('id', '');
	$password = MiscUtils::getParam('password', '');
	
	$sql ="select password from ns_v1customer where e_oid ='".$oid."'  limit 1";
	$customerinfo = getone($sql,1);
	
	
	if($customerinfo['password'] == $password)
	{
		echo '1';
	}else{
		echo '2';
	}
}

function updatepwd()
{
	$oid = MiscUtils::getParam('id', '');
	$password = MiscUtils::getParam('password', '');

	$sql = "update ns_v1customer set password = '".$password."' where e_oid = '".$oid."' ";
	sql_execute($sql);
	
	
	$sql ="select password from ns_v1customer where e_oid ='".$oid."'  limit 1";
	$customerinfo = getone($sql,1);
	
	echo $customerinfo['password'];
	
}









?>